#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 2e5 + 5;
const int M = 7e5 + 5;
int n, m, mx;
int x[N], y[N];
int bit[M];
int lowbit(int x) { return x & -x; }
void update(int x, int d) {
  for (int i = x; i <= mx; i += lowbit(i)) bit[i] += d;
}
int query(int x) {
  int res = x;
  for (int i = x; i > 0; i -= lowbit(i)) res += bit[i];
  return res;
}
int lb(int x) {
  int l = 1, r = x;
  while (l <= r) {
    int mid = (l + r) >> 1;
    if (query(mid) >= x)
      r = mid - 1;
    else
      l = mid + 1;
  }
  return l;
}
int rb(int x) {
  int l = 1, r = x;
  while (l <= r) {
    int mid = (l + r) >> 1;
    if (query(mid) <= x)
      l = mid + 1;
    else
      r = mid - 1;
  }
  return r;
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n;
  rep(i, 1, n) cin >> x[i] >> y[i];
  mx = n + 5e5;
  rep(i, 1, n) {
    int l = lb(x[i]);
    int r = rb(y[i]);
    if (r < l) continue;
    update(l, 1);
    update(r + 1, -1);
  }
  cin >> m;
  while (m--) {
    int x;
    cin >> x;
    cout << query(x) << endl;
  }
  return 0;
}